﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace ConsoleServer
{
    class Program
    {
        static void Main(string[] args)
        {
            string root = ConfigurationManager.AppSettings["root"];
            if (root == null || root == "")
            {
                root = "d:\\";
            }
            string sPort = ConfigurationManager.AppSettings["port"];
            if (sPort == null || sPort == "")
            {
                sPort = "10898";
            }
            int iport = 10898;
            if (!int.TryParse(sPort, out iport))
            {
                iport = 10898;
            }

            ThreadPool.QueueUserWorkItem(
                (WaitCallback)delegate(object state)
            {
                TcpDownServer.Server.Run(
                    iport,
                    root);
            }
            );
            Console.Write("Server Start");
            Console.Read();
        }
    }
}
